package com.example.app.invoketask.asynccallback;

import com.example.app.invoketask.AbstractTask;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Component;

import java.util.concurrent.Future;

/**
 * @author wangzhuangzhuang
 * @DESC:
 * @date 2022-02-10 13:40
 */
@Component
public class AsyncCallBackTask extends AbstractTask {
	@Async
	public Future<String> doTaskOneCallback() throws Exception {
		super.doTaskOne();
		return new AsyncResult<>(">>>>>>Task 1 has finished!<<<<<<");
	}

	@Async
	public Future<String> doTaskTwoCallback() throws Exception {
		super.doTaskTwo();
		return new AsyncResult<>(">>>>>>Task 2 has finished!<<<<<<");
	}

	@Async
	public Future<String> doTaskThreeCallback() throws Exception {
		super.doTaskThree();
		return new AsyncResult<>(">>>>>>Task 3 has finished!<<<<<<");
	}

}